package org.example.service;

import org.example.controller.request.ShortLinkAddRequest;
import org.example.controller.request.ShortLinkDelRequest;
import org.example.controller.request.ShortLinkPageRequest;
import org.example.controller.request.ShortLinkUpdateRequest;
import org.example.model.EventMessage;
import org.example.util.JsonData;
import org.example.vo.ShortLinkVO;

import java.util.Map;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author 谢超
 * @since 2023-08-15
 */
public interface ShortLinkService{

    /**
     * 解析短链
     * @param shortLinkCode
     * @return
     */
    ShortLinkVO parseShortLinkCode(String shortLinkCode);

    /**
     * 创建短链
     * @param request
     * @return
     */
    JsonData addShortLink(ShortLinkAddRequest request);

    /**
     * 处理新增短链消息(判断短链是否符合规范)
     * @param eventMessage
     */
    boolean handlerAddShortLink(EventMessage eventMessage);

    /**
     * 处理更新短链消息(判断短链是否符合规范)
     * @param eventMessage
     */
    boolean handlerUpdateShortLink(EventMessage eventMessage);

    /**
     * 删除短链
     * @param eventMessage
     * @return
     */
    boolean handlerDelShortLink(EventMessage eventMessage);

    /**
     * 分页查找短链
     * @param request
     * @return
     */
    Map<String, Object> pageByGroupId(ShortLinkPageRequest request);

    /**
     * 删除短链
     * @param request
     * @return
     */
    JsonData delLinkCode(ShortLinkDelRequest request);

    /**
     *  更新短链
     * @param request
     * @return
     */
    JsonData updateLink(ShortLinkUpdateRequest request);

}
